package com.yue.rpc.controller;

import com.yue.rpc.dubbo.RpcDemoService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author zhangqiyue
 * @Description
 * @Date 2023/3/16 20:02
 */
@RestController
@RequestMapping("/dubbo")
public class DubboClientController {
    @DubboReference
    private RpcDemoService rpcDemoService;

    @GetMapping("/test")
    public Long test() {
        long beginTime = System.currentTimeMillis();
        for(int i=0;i<10000;++i){
            String zqy = rpcDemoService.testRpc("ZQY");
        }
        long endTime = System.currentTimeMillis();
        return endTime-beginTime;
    }
}
